package com.byx.chatserver.util;


import org.apache.commons.codec.binary.Base64;

/**
 * @ClassName Base64Util
 * @Description base64工具类
 * @Author Superb
 * @Date 2021/5/4
 * @Version 1.0
 */
public class Base64Util {
    /**
     * 使用Base64解码
     * @param encodeStr 经Base64编码后的字符串
     * @return 解码后的字符串
     */
    public static String decode(String encodeStr){
        byte[] md5= Base64.decodeBase64(encodeStr);
        StringBuilder result = new StringBuilder();
        for (byte b :md5){
            result.append(b < 0 ? (char) (b + 0x100) : ((char) b));
        }
        return result.toString();
    }
}
